package com.hoo.client;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.hoo.entity.User.User;
import com.hoo.service.IComplexUserService;

public class SpringUsersWsClient {
	public static void main(String[] args) {
		// 调用WebService
		 JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		 factory.setServiceClass(IComplexUserService.class);
		 factory.setAddress("http://14.17.99.201:8080/cxf-spring/Users");
		 IComplexUserService service = (IComplexUserService) factory.create();
		 System.out.println("#############ClientgetUserByName##############");
		 User user = service.getUserByName("hoojo");
		 System.out.println(user);
		 user.setAddress("China-Guangzhou");
		 service.setUser(user);
		/*ApplicationContext ctx = new ClassPathXmlApplicationContext(
				"applicationContext-client.xml");
		IComplexUserService service = ctx.getBean("userWsClient",
				IComplexUserService.class);
		System.out.println("#############Client getUserByName##############");
		User user = service.getUserByName("呵呵");
		
		user.setAddress("成都");
		service.setUser(user);
		System.out.println("========================="+user.getName());*/
		
		
	}
}
